package com.crm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.crm.entity.Netfollows;
import com.crm.entity.Student;
import com.crm.service.NetfollowsService;
import com.crm.util.FenyeUtil;

@RestController
@RequestMapping("netfollow")
public class NetfollowsController {

	@Autowired
	private NetfollowsService netfollowsService;
	
	@GetMapping
	public FenyeUtil<Netfollows> Get(Netfollows netf,Integer page,String userid,String stuId){
		
		return netfollowsService.FindAskerByPage(netf, page, userid,stuId);
	}
	@DeleteMapping
	public String del(Integer nid) {
		return netfollowsService.DelNetfollow(nid);
	}
	@PostMapping
	public String add(Netfollows netf,String stuid,String userid) {
        return netfollowsService.AddNetFollow(netf, stuid, userid);
	}
	@PutMapping
	public String upd(Netfollows netf) {
		System.out.println(netf);
		return netfollowsService.UpdNetFollow(netf);
	}
	@GetMapping
	@RequestMapping("/getAllStu")
	public List<Student> getStu(){
		return netfollowsService.findAllStu();
	}
	
	
}
